'use strict';
const BaseController = require('../base');
class RouterController extends BaseController {
  static get serviceName() {
    return 'business.dailyMenu';
  }

  // 获取供应商的菜单列表
  async getSupplierMenus() {
    const { ctx } = this;
    const { supplierId } = ctx.query;
    if (!supplierId) {
      ctx.error(400, '供应商ID不能为空');
      return;
    }
    const result = await this.service.getSupplierMenus(supplierId);
    ctx.success(result);
  }

  // 获取采购员的菜单列表
  async getPurchaserMenus() {
    const { ctx } = this;
    const { purchaserId } = ctx.query;
    if (!purchaserId) {
      ctx.error(400, '采购员ID不能为空');
      return;
    }
    const result = await this.service.getPurchaserMenus(purchaserId);
    ctx.success(result);
  }

  // 获取采购统计数据
  async getPurchaseStatistics() {
    const { ctx } = this;
    const result = await this.service.getPurchaseStatistics();
    ctx.success(result);
  }
}
module.exports = RouterController;
